<fieldset>
 <legend>Enter a text to search: </legend>

<% form_tag search_path,:method=>"get" do %>
   <p> <%= image_tag "twitter-logo-large.png" %> </p>
	 <p> <%= text_field_tag :search,"",:size => 40 %> </p>
	 <p> <%= submit_tag "Search" %> </p>
 <%end%>
</fieldset>


<fieldset>
<% unless @tweets.empty? %>
 <p>Realtime results for <b><%= @text %></b></p>

<% @tweets.each do |tweet| %>
	<p>
		<b><%= tweet.from_user %> </b> &nbsp;
		   <% text = tweet.text.split(" ") %>
			 <% search= "" %>
			 <% text.each do |txt| %>
					<% if params[:search].include?(txt) %>
			 	    <% search += "<span style='background:yellow;font-style:bold;'>#{txt}</span>" %>
					<%else%>
			 	    <% search += " " + txt + " " %> 
					<%end%>
			<%end%>			   
			<%= search %>
	</p>
<%end%>
<%else%>
	<p> No Results found</p>
<%end%>
</fieldset>
